package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(30);not null;commit:'用户名'"`
	Password string `gorm:"type:varchar(100);not null;commit:'密码'"`
}

func (u *User) Register(db *gorm.DB) error {
	return db.Debug().Create(u).Error
}

func (u *User) FindName(db *gorm.DB, username string) error {
	return db.Debug().Where("username=?", username).First(u).Error
}
